function test_01(){
   //alert("hello world");
   var name = "biyin";
   var age = 18;
   console.log('${name}, 今年${age}岁');

   //字符串方法
   var test = "wellCome Chongqing"
   test.length;
   console.log(test[0]);
   console.log(test.toUpperCase());
   console.log(test.substring(0, 5));
   //数组
   var arr  = ["biyin",20,null,true];
   console.log(arr);
   console.log(arr.length);
   console.log(arr);
   console.log(arr.join("-"));

   //对象
   var student = {
       name:"biyin",
       age:20,
       city:'CQ',
       zipcode:null
   };
   student.email = "2189023202@QQ.com";
   student.city;
   delete student.zipcode;

   //map
   var map = new Map();
   map.set('Adam',78);
   map.has('Adam');
   map.get('Adam');
   map.delete('Adam');

   //Set
   var s1 = new Set();
   var S2 = new Set([1,2,3]);
   s1.add(4);
   s1.delete(3);
   console.log(s1);

   //运算符

   console.log(5%3);
   console.log(-5%3);
   console.log(5%-3);
   console.log(-5%-3);

   console.log(1 =="1");
   console.log([1,2,3] == new Array(1,2,3));
   console.log([] == []);
   console.log(null == undefined);
   console.log(null === undefined);
   console.log(NaN == NaN);

   //条件判断
   var age = 18
   if (age <= 18){
       console.log("青少年");
   }else if (age > 18 && age < 65){
       console.log("青壮年")
   }else {
       console.log("退休")
   }

    //循环
    var i;
    for (i = 0;i < arr.length;i++){
        console.log(arr[i]);
        console.log(arr[i]);
    }
    for(var item of arr){
        console.log(item);
    }
    arr.forEach(function(item){
        console.log(item);
    });
    //箭头函数
    var arr2 = [1,3,5,4,2,9,6];
    //循环
    arr2.forEach((item) => {
        console.log(item)
    });
    //包装
    console.log(arr2.map((item) => item * 3));

    //叠加
    var sum = 0;
    arr2.forEach(function(item){
        sum += item;
    });
    console.log(sum);
    console.log(arr2.reduce((item1,item2) => item1 + item2));
    //过滤
    console.log(arr2.filter((item) => item % 2 == 0));
    //排序
    console.log(arr2.sort((a,b) => b - a));
    //日期
    var date = new Date(1435146562875);
    console.log(date.getFullYear() + "-" + (date.getMonth()) + "-" + (date.getDay()));
    console.log(Date.parse("2015-06-24T19:49:22.875+08:00"));

    //正则
    //var reg = ;
    /^[0-9]+.?[0-9]*$/; //正小数
    /^(0|\+?[1-9][0-9]*)$/; //0和正整数
    /^[1-9]\d*$/; //正整数
    /^\d+$|^(\d+).?(\d{1,2})$/; //保留两位小
    /^(:?(:?\d+.\d+)|(:?\d+))$/; //double
    let regex = /^\d+$|^(\d+).?(\d{1,2})$/;
    var re1 = /ABC\-001/;
    var re2 = new RegExp('ABC\\-001');
    var re = /^\d{3}\-\d{3,8}$/;
    re.test('010-12345'); // true
    re.test('010-1234x'); // false
    re.test('010 12345'); // false
    'a b   c'.split(/\s+/);
    var re = /^(\d{3})-(\d{3,8})$/;
    re.exec('010-12345'); // ['010-12345', '010', '12345']
    re.exec('010 12345'); // null

    //json
    //var s = JSON.stringify(person);
    console.log(JSON.parse('[1,2,3,true]')); // [1, 2, 3, true]
    console.log(JSON.parse('{"name":"小明","age":14}')); // Object {name: '小明', age: 14}
    console.log(JSON.parse('true')); // true
    console.log(JSON.parse('123.45')); // 123.45
    //var result = eval("(" + data + ")"); // data 为 Json 字符串
    //console.log(result);

}
